package com.zbkj.dal.common.enums;

import com.zbkj.dal.common.exception.CrmebException;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;

@AllArgsConstructor
public enum SFExpressOrderPushState {

    /**
     * 运单状态枚举类型
     */
    _04("04", "调度失败/等待"),
    _40001("04-40001", "调度成功+收派员信息"),
    _40037("04-40037", "下单已接收"),
    _40021("04-40002-40021", "电话号码异常(电话错误/空号/停机)"),
    _40022("04-40002-40022", "无法进入客户处,且客户不愿出来"),
    _40004("04-40002-40004", "暂未联系上客户(电话无人接听/无法接通/关机)"),
    _40005("04-40002-40005", "经客户同意,更改收派时间"),
    _40027("04-40002-40027", "天气原因,延误收派件"),
    _40028("04-40002-40028", "交通原因,延误收派件"),
    _40031("04-40002-40031", "不符合收件要求,无法揽收"),
    _40014("04-40002-40014", "客户取消寄件"),
    _40015("04-40002-40015", "客户重复下单"),
    _40016("04-40002-40016", "下错单需转单"),
    _40035("04-40002-40035", "工作量过大,延误收派件"),
    _40036("04-40002-40036", "重货需转单"),
    _1000("00-40045-1000", "调度取消订单"),
    _2000("00-2000", "客户已取消订单"),
    _40003("05-40003", "已正常收件状态"),
    _0440065("04-40002-40065", "订单超时结束"),
    _0040065("00-40065", "订单超时结束"),
    _20001("00-20001", "订单取消"),
    _40019("04-40019", "已取件"),
    _40054("00-40045-40054", "人工审补消单"),
    _40046("00-40045-40046", "人工补审消单"),
    _40070("00-40070", "因疫情交通管控，当地暂时无法提供收派服务"),
    _40071("00-40071", "取消未支付");

    private final String code;
    private final String desc;


    public static SFExpressOrderPushState of(String code) {
        for (SFExpressOrderPushState value : values()) {
            if (StringUtils.equals(code, value.code)) {
                return value;
            }
        }
        throw new CrmebException("不存在的订单状态");
    }
}
